<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | 王勇程 <laughskydragon@qq.com>                         |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\logic;

use app\common\logic\Price as CommonPrice;

/**
 * 价格管理逻辑层
 */
class Price extends AdminBase
{
    
    public static $commonPriceLogic = null;
    
    /**
     * 基类初始化
     */
    public function __construct()
    {
        // 执行父类构造方法
        parent::__construct();
        
        empty(static::$commonPriceLogic) && static::$commonPriceLogic = new CommonPrice();
    }
    
    /**
     * 获取价格列表搜索条件
     */
    public function getWhere($data = [])
    {
        return static::$commonPriceLogic->getWhere($data);
    }
    
    /**
     * 获取价格列表
     */
    public function getPriceList($where = [], $field = true, $order = 'id desc', $paginate = DB_LIST_ROWS)
    {
        return static::$commonPriceLogic->getPriceList($where, $field, $order, $paginate);
    }
    
    /**
     * 获取价格详情
     */
    public function getPriceDetail($data = [])
    {
        return static::$commonPriceLogic->getPriceDetail($data);
    }
    
    /**
     * 获取价格历史
     */
    public function getPriceHistory($data = [])
    {
        return static::$commonPriceLogic->getPriceHistory($data);
    }

    /**
     * 获取价格变动记录（按时间倒序，用于后台管理查看）
     */
    public function getPriceChangeRecords($data = [])
    {
        return static::$commonPriceLogic->getPriceChangeRecords($data);
    }
    
    /**
     * 获取价格趋势
     */
    public function getPriceTrend($data = [])
    {
        return static::$commonPriceLogic->getPriceTrend($data);
    }
    
    /**
     * 保存价格预警
     */
    public function savePriceAlert($data = [])
    {
        return static::$commonPriceLogic->savePriceAlert($data);
    }
    
    /**
     * 批量价格调整
     */
    public function batchPriceAdjust($data = [])
    {
        return static::$commonPriceLogic->batchPriceAdjust($data);
    }
    
    /**
     * 保存价格变动
     */
    public function savePriceChange($data = [])
    {
        return static::$commonPriceLogic->savePriceChange($data);
    }
    
    /**
     * 获取价格统计
     */
    public function getPriceStats($data = [])
    {
        return static::$commonPriceLogic->getPriceStats($data);
    }
    
    /**
     * 导出价格历史
     */
    public function exportPriceHistory($data = [])
    {
        return static::$commonPriceLogic->exportPriceHistory($data);
    }
    
    /**
     * 价格添加
     */
    public function priceAdd($data = [])
    {
        return static::$commonPriceLogic->priceAdd($data);
    }
    
    /**
     * 价格编辑
     */
    public function priceEdit($data = [])
    {
        return static::$commonPriceLogic->priceEdit($data);
    }
    
    /**
     * 价格删除
     */
    public function priceDel($data = [])
    {
        return static::$commonPriceLogic->priceDel($data);
    }
    
    /**
     * 获取价格信息
     */
    public function getPriceInfo($data = [])
    {
        return static::$commonPriceLogic->getPriceInfo($data);
    }
    
    /**
     * 价格监控
     */
    public function priceMonitor($data = [])
    {
        return static::$commonPriceLogic->priceMonitor($data);
    }
    
    /**
     * 获取监控列表
     */
    public function getMonitorList($data = [])
    {
        return static::$commonPriceLogic->getMonitorList($data);
    }
    
    /**
     * 导出价格列表
     */
    public function exportPriceList($where = [])
    {
        return static::$commonPriceLogic->exportPriceList($where);
    }
}